package com.qf.service.impl;

import com.qf.mapper.GoodsDetailMapper;
import com.qf.pojo.GoodsDetail;
import com.qf.service.GoodsDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class GoodsDetailServiceImpl implements GoodsDetailService {

    @Autowired
    private GoodsDetailMapper goodsDetailMapper;

    @Override
    public List<GoodsDetail> findAll() {
        return goodsDetailMapper.selectByExample(null) ;
    }

    @Override
    public void deleteById(Integer goodId) {
        goodsDetailMapper.deleteByPrimaryKey(goodId);
    }

    @Override
    public void deleteAll(Integer[] goodIds) {
        for (Integer goodId : goodIds) {
            goodsDetailMapper.deleteByPrimaryKey(goodId);
        }
    }

    @Override
    public void updateGoods(GoodsDetail goodsDetail) {
        goodsDetailMapper.updateByPrimaryKeySelective(goodsDetail);
    }

    @Override
    public void addGoods(GoodsDetail goodsDetail) {
        goodsDetailMapper.insertSelective(goodsDetail);
    }
}
